package com.truesai.entities.stock;

import java.math.BigDecimal;
import java.sql.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import com.truesai.entities.production.Production;

/**
 * 产品总库存快照<strong>统计分析</strong><br/>
 * 需求分析<br/>
 * 每天11点59生成一张产品库存总量的备份表。主要用于生成产品历史库存总量的二维统计图。
 * @author XuLian
 *
 */
@Entity
@NamedQueries(
{
        @NamedQuery(name = StockSnapshot.ALL, query = "Select ss from StockSnapshot ss"),
        @NamedQuery(name = StockSnapshot.BY_PRODUCTION, query = "Select ss from StockSnapshot ss where ss.production = :production"),
        @NamedQuery(name = StockSnapshot.BY_ID, query = "Select ss from StockSnapshot ss where ss.id = :id") })
@Table(name = "Stocks_snapshot")
public class StockSnapshot {
	
	public static final String ALL = "InventorySnapshot.all";

    public static final String BY_PRODUCTION = "InventorySnapshot.byProduction";

    public static final String BY_ID = "InventorySnapshot.byId";
    
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
    /**产品*/
    @ManyToOne
    private Production production;
    
    /**总量*/
    @Column
    private BigDecimal totalAmount;
    
    /**日期*/
    @Column
    private Date snapshotDate;

    
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Production getProduction() {
		return production;
	}

	public void setProduction(Production production) {
		this.production = production;
	}

	public BigDecimal getTotalAmount() {
		return totalAmount;
	}

	public void setTotalAmount(BigDecimal totalAmount) {
		this.totalAmount = totalAmount;
	}

	public Date getSnapshotDate() {
		return snapshotDate;
	}

	public void setSnapshotDate(Date snapshotDate) {
		this.snapshotDate = snapshotDate;
	}
    
}
